#ifndef __SHAPECONTAINER_H__
#define __SHAPECONTAINER_H__

#include <iostream>
#include <vector>
#include <conio.h>
#include <string>
#include "Shape.h"
#include "MyScreen.h"
#include "Circle.h"
#include "CRectangle.h"
#include "HandleCollisions.h"

class ShapeContainer
{
	(vector<Shape*>)* m_ShapesArray;
	bool m_saveStamp;
	bool isLegalIndex ( unsigned int index) const;
public:	
	vector<Shape*>::iterator m_itr;
	vector<Shape*>::reverse_iterator m_rev_itr;
	ShapeContainer();
	~ShapeContainer();
	int getSize() const { return m_ShapesArray->size(); }
	bool getShape( unsigned int index,  Shape& shape) const;
	bool addRectangle(const char& inputType, ifstream & filename);
	bool addRectangle();
	bool addCircle(const char& inputType, ifstream & filename);
	bool addCircle();
	bool getSaveStamp() const {return m_saveStamp;} 
	void setSaveStamp(bool saveStamp) {m_saveStamp = saveStamp;} 
	void addShapeToArray(Shape* shape);
	bool set( unsigned int index, Shape& shape);
	bool shapeDelete( unsigned int index);
	bool moveShapeToBack ( unsigned int index);
	bool moveShapeToFront ( unsigned int index);
	bool setAxis ( unsigned int index, int axisX,  int axisY);
	void drawAll( unsigned int drawType) ;
	void drawSpecific ( unsigned int drawType,  unsigned int index , char ch) ;
	bool searchShape (const  Point& p1, unsigned int& index) ;
	bool setDirection( unsigned int index,  double dirX,  double dirY);
	void drawToScreen (MyScreen * scr , unsigned int drawType,  char ch='*') ;
	void drawToScreenWithoutSplit (MyScreen * scr ,  unsigned int drawType,  char ch='*') ;
	void drawToScreenWithCollision (MyScreen * scr) ;
	void drawAllWithoutIndex(int index ,MyScreen * scr , char frame);
	void addTimeToAnim ();
	void updatePrintWithSplit ();
	void initPrintWithSplit ();
	void initSum();
	void restoreOriginalDir();
	void saveOriginalDir();
	void checkStuckShape() ;
	bool writeToText (ofstream & filename);
	bool writeToBin (ofstream & filename);
	bool readFromText (ifstream & filename);
	bool readFromBin (ifstream & filename);
	bool readShapeFromFile (const string& shapeName, const char fileType, ifstream & filename);
	void free();
};

#endif

